Source-level fixes for Spring Boot 3 / Java 17 migration - #65
amitmanchella-cog wants to merge 1 commit into
Conversation
… Spring Boot 3 Co-Authored-By: Amit Manchella <amit.manchella@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| jdbcTemplate.query( | ||
| "SELECT id, first_name, last_name FROM customers WHERE first_name = ?", new Object[]{"Josh"}, | ||
| (rs, rowNum) -> new Customer(rs.getLong("id"), rs.getString("first_name"), rs.getString("last_name")) | ||
| "SELECT id, first_name, last_name FROM customers WHERE first_name = ?", | ||
| (rs, rowNum) -> new Customer(rs.getLong("id"), rs.getString("first_name"), rs.getString("last_name")), | ||
| "Josh" | ||
| ).forEach(customer -> log.info(customer.toString())); |
There was a problem hiding this comment.
📝 Info: Varargs query overload resolves unambiguously with a 2-arg lambda
The switch to query(String, RowMapper, Object...) was checked against the other JdbcTemplate.query overloads that end in varargs (ResultSetExtractor, RowCallbackHandler) as well as query(String, PreparedStatementSetter, RowMapper). All of those functional interfaces take a single argument, so the two-parameter lambda (rs, rowNum) -> ... can only match RowMapper; resolution is unambiguous and the returned List<Customer> is still iterated as before.
Was this helpful? React with 👍 or 👎 to provide feedback.
| @@ -5,18 +5,14 @@ | |||
| import java.util.stream.Collectors; | |||
|
|
|||
| import hello.model.Customer; | |||
There was a problem hiding this comment.
📝 Info: Unreferenced Quote/Value model classes left behind
With the quote fetch removed, hello.model.Quote and hello.model.Value are now completely unreferenced (grep shows no remaining usages outside those files). The PR intentionally keeps them, but they are dead code that will silently rot; consider deleting them in a follow-up so the migration doesn't leave orphaned model classes.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Agreed they're dead code now. Leaving them out of this PR deliberately: the scope handed to me was to remove the fetch logic and its imports, and deleting the model classes is a separate (if trivial) call that also touches a sibling session's expectations of the tree. Happy to drop Quote/Value here if the owner prefers — otherwise it's a clean follow-up.
Summary
Java-source part of the Java 8 / Boot 2.0.2 → Java 17 / Boot 3.3.x migration. Build files (
pom.xml,build.gradle) are intentionally untouched — sibling PRs own those.Dead quote service removed from
Application.http://gturnquist-quoters.cfapps.iono longer resolves, so both call sites threw at startup. Removed the fetch inmain(), the wholerun(RestTemplate)CommandLineRunnerbean (its only purpose was that call), and theRestTemplatebean that fed it, plus the now-unused imports. The@Override run(String...)JdbcTemplate logic and bean-name printing inmain()are unchanged. TheQuote/Valuemodel classes are left in place (unreferenced, but not part of the failing path).Removed Spring 6 API.
JdbcTemplate.query(String, Object[], RowMapper)was deleted in Spring Framework 6; switched to the varargs overload (present in both Spring 5 and 6, so this compiles before and after the Boot bump):javax.*→jakarta.*: no changes needed.grep -rn "javax" src/returns nothing — the app only uses Spring/JDK APIs, no servlet/validation/persistence imports.Controller modernization.
@RequestMapping(method = ...)→@GetMapping/@PostMapping/@PutMapping/@DeleteMappingacrossTopicController,GreetingController,HelloController. Paths and handler bodies are unchanged; the previously method-less@RequestMappinghandlers are now explicitly GET-only (they were all read endpoints).Sanity-checked with
mvn compileagainst the current (still Boot 2.0.2) build.Link to Devin session: https://app.devin.ai/sessions/8c90d4fdcb7a42eba82850747a790f7e
Requested by: @amitmanchella-cog
Devin Review